﻿using System;
using System.ServiceModel.Security;
using DeSleeper.Client.Framework;
using DeSleeper.Client.Properties;
using NLog;

namespace DeSleeper.Client.WakeUp
{
	public class WakeUpCommand : AsyncCommand
	{
		private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
		public override string Text { get { return Resources.WakeUpCommandName; } }

	    /// <exception cref="InvalidOperationException">Invalid Host Name.</exception>
		/// <exception cref="SecurityAccessDeniedException">Service authentication failed.</exception>
		protected override void OnExecute(object parameter)
		{
			var parameters = parameter as TargetComputer;
			if (parameters == null)
				return;

            parameters.WakeUp();
		}
	}
}